package com.voyage.generator.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.voyage.common.constant.PageMO;
import com.voyage.generator.entity.CodeConfig;
import com.voyage.generator.mapper.GenConfigRepository;
import com.voyage.generator.service.GenConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author: kangb on 2021/10/8 22:01
 * @param:
 * @return:
 * @Description:
 */
@Service
public class GenConfigServiceImpl implements GenConfigService {

    private GenConfigRepository genConfigRepository;

    @Autowired
    public GenConfigServiceImpl(GenConfigRepository genConfigRepository) {
        this.genConfigRepository = genConfigRepository;
    }

    @Override
    public IPage<CodeConfig> list(PageMO pageMO) {
        IPage<CodeConfig> page = new Page<>(pageMO.getCurrent(),pageMO.getSize());
        QueryWrapper<CodeConfig> queryWrapper = new QueryWrapper<>();
        queryWrapper.like("table_name",pageMO.getData());
        return genConfigRepository.selectPage(page, queryWrapper);
    }

}
